<template>
  <div>
    <search v-if="!isShowSeachGoods" @callback="callback" />
    <goods v-if="isShowSeachGoods" :router="routerVal" :keyword="keyword" />
  </div>
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import search from './search.vue';
import goods from '@/pages/goods/search/goods.vue';
const isShowSeachGoods = ref<boolean>(false);
const keyword = ref<any>();
const routerVal = ref<any>('');
function callback(value?: any) {
  keyword.value = value;
  isShowSeachGoods.value = true;
}

onLoad(async (option: any) => {
  routerVal.value = option
  if (option && (option.category || option.promotionsId)) {
    callback();
  }
})


</script>

<style scoped>
page {
  background: #fff;
}
</style>

<style scoped lang="scss"></style>
